package com.jic.market.impl;


import com.jic.common.base.vo.Page;
import com.jic.common.base.vo.PageResult;
import com.jic.market.entity.PatchGrouponCustomerRobotModel;
import com.jic.market.mapper.PatchGrouponCustomerRobotMapper;
import com.jic.market.service.PPatchGrouponCustomerRobotService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 *   服务类
 *
 * @author xuyongliang
 * @since 2020-03-26
 */
@Service
public class PatchGrouponCustomerRobotServiceImpl implements PPatchGrouponCustomerRobotService{

    @Autowired
    private PatchGrouponCustomerRobotMapper modelMapper;

    /**
     *  新增
     * @param modelEntity
     */
    @Override
    public Integer patchGrouponCustomerRobotAdd(PatchGrouponCustomerRobotModel modelEntity){
        return modelMapper.patchGrouponCustomerRobotAdd(modelEntity);
    }

    /**
     *  编辑
     * @param modifyEntity
     * @param whereCondition
     */
    @Override
    public Integer patchGrouponCustomerRobotEdit(PatchGrouponCustomerRobotModel modifyEntity, PatchGrouponCustomerRobotModel whereCondition){
        return modelMapper.patchGrouponCustomerRobotEdit(modifyEntity, whereCondition);
    }

    /**
     *  删除
     * @param \
     */
    @Override
    public Integer patchGrouponCustomerRobotDelete(Map map){
        return modelMapper.patchGrouponCustomerRobotDelete(map);
    }

    /**
     *  查询详情
     * @param
     */
    @Override
    public PatchGrouponCustomerRobotModel patchGrouponCustomerRobotQuery(Map map){
        return modelMapper.patchGrouponCustomerRobotQuery(map);
    }

    /**
     *  分页查询
     * @param
     */
    @Override
    public PageResult<PatchGrouponCustomerRobotModel> patchGrouponCustomerRobotQueryPageList(PatchGrouponCustomerRobotModel modelEntity, Page pageQuery){
        //计算下标
        int startIndex = (pageQuery.getStart() - 1) * pageQuery.getLimit();
        List<PatchGrouponCustomerRobotModel> list = modelMapper.patchGrouponCustomerRobotQueryPageList(startIndex, pageQuery.getLimit(), modelEntity);
        long count = modelMapper.patchGrouponCustomerRobotQueryPageCount(modelEntity);
        PageResult pageResult = new PageResult();
        pageResult.setRows(list);
        pageResult.setTotal(count);
        return pageResult;
    }

    /**
    *   修改单据状态
    *  @param \
    */
    @Override
    public Integer patchGrouponCustomerRobotChangeStatus(Map map){
        return modelMapper.patchGrouponCustomerRobotChangeStatus(map);
    }

    /**
     *   修改审批状态
     * @param \
     */
    @Override
    public Integer patchGrouponCustomerRobotChangeApproveStatus(Map map){
        return modelMapper.patchGrouponCustomerRobotChangeApproveStatus(map);
    }

}